<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <input type="text" class="user"> <br>
    <input type="text" class="pwd"> <br>
    <button>注册</button>



    <script>



        const oUser = document.querySelector('.user');
        const oPwd = document.querySelector('.pwd');
        const oBtn = document.querySelector('button');


        // 
        oBtn.onclick = function () {
            const user = oUser.value;
            const pwd = oPwd.value;
            const res = localStorage.getItem('YYDS_' + user);
            if (res) {
                alert('已被注册');
            } else {
                localStorage.setItem('YYDS_' + user, pwd);
                // location.href = './10login.html';
            }
        }

    </script>

</body>

</html>